import 'package:flutter_admin/utils/utils.dart';

class SaleBidProject {
  String? id;
  String? projectcategory;
  String? projectcode;
  String? projectname;
  String? projectnation;
  String? province;
  String? projectnature;
  String? customername;
  String? bidcategory;
  String? bidagency;
  String? productname;
  String? projectattribute;
  String? projectsize;
  num? projectbudget;
  String? buydeadline;
  String? clarifydeadline;
  String? biddeadline;
  String? openingdate;
  String? publicitydate;
  String? deliverydate;
  num? tenderfee;
  num? bidfree;
  num? checkfee;
  String? agencyservicefee;
  String? performancebond;
  String? bidmethod;
  String? priceevaluation;
  String? businesscontacts;
  String? businesscontactsnumber;
  String? technologycontacts;
  String? technologycontactsnumber;
  String? issecondbargaining;
  String? projectintroduction;
  String? qualificationdocuments;
  String? samplerequirements;
  String? brandpatentrequirements;
  String? environmentalrequirements;
  String? packagingrequirements;
  String? bidmaker;
  String? bidresults;
  String? pricedetermination;
  num? quotationaccuracy;
  num? profitmargin;
  String? profit;
  String? formId;
  String? formNo;
  String? createUid;
  String? createDate;
  String? writeUid;
  String? writeDate;
  String? createDateStart;
  String? createDateEnd;

  SaleBidProject({
    this.id,
    this.projectcategory,
    this.projectcode,
    this.projectname,
    this.projectnation,
    this.province,
    this.projectnature,
    this.customername,
    this.bidcategory,
    this.bidagency,
    this.productname,
    this.projectattribute,
    this.projectsize,
    this.projectbudget,
    this.buydeadline,
    this.clarifydeadline,
    this.biddeadline,
    this.openingdate,
    this.publicitydate,
    this.deliverydate,
    this.tenderfee,
    this.bidfree,
    this.checkfee,
    this.agencyservicefee,
    this.performancebond,
    this.bidmethod,
    this.priceevaluation,
    this.businesscontacts,
    this.businesscontactsnumber,
    this.technologycontacts,
    this.technologycontactsnumber,
    this.issecondbargaining,
    this.projectintroduction,
    this.qualificationdocuments,
    this.samplerequirements,
    this.brandpatentrequirements,
    this.environmentalrequirements,
    this.packagingrequirements,
    this.bidmaker,
    this.bidresults,
    this.pricedetermination,
    this.quotationaccuracy,
    this.profitmargin,
    this.profit,
    this.formId,
    this.formNo,
    this.createUid,
    this.createDate,
    this.writeUid,
    this.writeDate,
    this.createDateStart,
    this.createDateEnd,
  });

  SaleBidProject copyWith({
    String? id,
    String? projectcategory,
    String? projectcode,
    String? projectname,
    String? projectnation,
    String? province,
    String? projectnature,
    String? customername,
    String? bidcategory,
    String? bidagency,
    String? productname,
    String? projectattribute,
    String? projectsize,
    num? projectbudget,
    String? buydeadline,
    String? clarifydeadline,
    String? biddeadline,
    String? openingdate,
    String? publicitydate,
    String? deliverydate,
    num? tenderfee,
    num? bidfree,
    num? checkfee,
    String? agencyservicefee,
    String? performancebond,
    String? bidmethod,
    String? priceevaluation,
    String? businesscontacts,
    String? businesscontactsnumber,
    String? technologycontacts,
    String? technologycontactsnumber,
    String? issecondbargaining,
    String? projectintroduction,
    String? qualificationdocuments,
    String? samplerequirements,
    String? brandpatentrequirements,
    String? environmentalrequirements,
    String? packagingrequirements,
    String? bidmaker,
    String? bidresults,
    String? pricedetermination,
    num? quotationaccuracy,
    num? profitmargin,
    String? profit,
    String? createUid,
    String? createDate,
    String? writeUid,
    String? writeDate,
  }) {
    return new SaleBidProject(
      id: id ?? this.id,
      projectcategory: projectcategory ?? this.projectcategory,
      projectcode: projectcode ?? this.projectcode,
      projectname: projectname ?? this.projectname,
      projectnation: projectnation ?? this.projectnation,
      province: province ?? this.province,
      projectnature: projectnature ?? this.projectnature,
      customername: customername ?? this.customername,
      bidcategory: bidcategory ?? this.bidcategory,
      bidagency: bidagency ?? this.bidagency,
      productname: productname ?? this.productname,
      projectattribute: projectattribute ?? this.projectattribute,
      projectsize: projectsize ?? this.projectsize,
      projectbudget: projectbudget ?? this.projectbudget,
      buydeadline: buydeadline ?? this.buydeadline,
      clarifydeadline: clarifydeadline ?? this.clarifydeadline,
      biddeadline: biddeadline ?? this.biddeadline,
      openingdate: openingdate ?? this.openingdate,
      publicitydate: publicitydate ?? this.publicitydate,
      deliverydate: deliverydate ?? this.deliverydate,
      tenderfee: tenderfee ?? this.tenderfee,
      bidfree: bidfree ?? this.bidfree,
      checkfee: checkfee ?? this.checkfee,
      agencyservicefee: agencyservicefee ?? this.agencyservicefee,
      performancebond: performancebond ?? this.performancebond,
      bidmethod: bidmethod ?? this.bidmethod,
      priceevaluation: priceevaluation ?? this.priceevaluation,
      businesscontacts: businesscontacts ?? this.businesscontacts,
      businesscontactsnumber:
          businesscontactsnumber ?? this.businesscontactsnumber,
      technologycontacts: technologycontacts ?? this.technologycontacts,
      technologycontactsnumber:
          technologycontactsnumber ?? this.technologycontactsnumber,
      issecondbargaining: issecondbargaining ?? this.issecondbargaining,
      projectintroduction: projectintroduction ?? this.projectintroduction,
      qualificationdocuments:
          qualificationdocuments ?? this.qualificationdocuments,
      samplerequirements: samplerequirements ?? this.samplerequirements,
      brandpatentrequirements:
          brandpatentrequirements ?? this.brandpatentrequirements,
      environmentalrequirements:
          environmentalrequirements ?? this.environmentalrequirements,
      packagingrequirements:
          packagingrequirements ?? this.packagingrequirements,
      bidmaker: bidmaker ?? this.bidmaker,
      bidresults: bidresults ?? this.bidresults,
      pricedetermination: pricedetermination ?? this.pricedetermination,
      quotationaccuracy: quotationaccuracy ?? this.quotationaccuracy,
      profitmargin: profitmargin ?? this.profitmargin,
      profit: profit ?? this.profit,
      createUid: createUid ?? this.createUid,
      createDate: createDate ?? this.createDate,
      writeUid: writeUid ?? this.writeUid,
      writeDate: writeDate ?? this.writeDate,
    );
  }

  @override
  String toString() {
    return '''SaleBidProject{
      id: id,
      projectcategory: projectcategory,
      projectcode: projectcode,
      projectname: projectname,
      projectnation: projectnation,
      province: province,
      projectnature: projectnature,
      customername: customername,
      bidcategory: bidcategory,
      bidagency: bidagency,
      productname: productname,
      projectattribute: projectattribute,
      projectsize: projectsize,
      projectbudget: projectbudget,
      buydeadline: buydeadline,
      clarifydeadline: clarifydeadline,
      biddeadline: biddeadline,
      openingdate: openingdate,
      publicitydate: publicitydate,
      deliverydate: deliverydate,
      tenderfee: tenderfee,
      bidfree: bidfree,
      checkfee: checkfee,
      agencyservicefee: agencyservicefee,
      performancebond: performancebond,
      bidmethod: bidmethod,
      priceevaluation: priceevaluation,
      businesscontacts: businesscontacts,
      businesscontactsnumber: businesscontactsnumber,
      technologycontacts: technologycontacts,
      technologycontactsnumber: technologycontactsnumber,
      issecondbargaining: issecondbargaining,
      projectintroduction: projectintroduction,
      qualificationdocuments: qualificationdocuments,
      samplerequirements: samplerequirements,
      brandpatentrequirements: brandpatentrequirements,
      environmentalrequirements: environmentalrequirements,
      packagingrequirements: packagingrequirements,
      bidmaker: bidmaker,
      bidresults: bidresults,
      pricedetermination: pricedetermination,
      quotationaccuracy: quotationaccuracy,
      profitmargin: profitmargin,
      profit: profit,
      profit: profit,
      createUid: createUid,
      createDate: createDate,
      writeUid: writeUid,
      writeDate: writeDate,
    }''';
  }

  @override
  bool operator ==(Object other) =>
      identical(this, other) ||
      (other is SaleBidProject &&
          runtimeType == other.runtimeType &&
          id == other.id &&
          projectcategory == other.projectcategory &&
          projectcode == other.projectcode &&
          projectname == other.projectname &&
          projectnation == other.projectnation &&
          province == other.province &&
          projectnature == other.projectnature &&
          customername == other.customername &&
          bidcategory == other.bidcategory &&
          bidagency == other.bidagency &&
          productname == other.productname &&
          projectattribute == other.projectattribute &&
          projectsize == other.projectsize &&
          projectbudget == other.projectbudget &&
          buydeadline == other.buydeadline &&
          clarifydeadline == other.clarifydeadline &&
          biddeadline == other.biddeadline &&
          openingdate == other.openingdate &&
          publicitydate == other.publicitydate &&
          deliverydate == other.deliverydate &&
          tenderfee == other.tenderfee &&
          bidfree == other.bidfree &&
          checkfee == other.checkfee &&
          agencyservicefee == other.agencyservicefee &&
          performancebond == other.performancebond &&
          bidmethod == other.bidmethod &&
          priceevaluation == other.priceevaluation &&
          businesscontacts == other.businesscontacts &&
          businesscontactsnumber == other.businesscontactsnumber &&
          technologycontacts == other.technologycontacts &&
          technologycontactsnumber == other.technologycontactsnumber &&
          issecondbargaining == other.issecondbargaining &&
          projectintroduction == other.projectintroduction &&
          qualificationdocuments == other.qualificationdocuments &&
          samplerequirements == other.samplerequirements &&
          brandpatentrequirements == other.brandpatentrequirements &&
          environmentalrequirements == other.environmentalrequirements &&
          packagingrequirements == other.packagingrequirements &&
          bidmaker == other.bidmaker &&
          bidresults == other.bidresults &&
          pricedetermination == other.pricedetermination &&
          quotationaccuracy == other.quotationaccuracy &&
          profitmargin == other.profitmargin &&
          profit == other.profit &&
          createUid == other.createUid &&
          createDate == other.createDate &&
          writeUid == other.writeUid &&
          writeDate == other.writeDate);

  factory SaleBidProject.fromMap(Map<String, dynamic> map) {
    return new SaleBidProject(
      id: map['id'] != false ? map['id'].toString() as String? : "",
      projectcategory: map['projectcategory'] != false
          ? map['projectcategory'].toString() as String?
          : "",
      projectcode: map['projectcode'] != false
          ? map['projectcode'].toString() as String?
          : "",
      projectname: map['projectname'] != false
          ? map['projectname'].toString() as String?
          : "",
      projectnation: map['projectnation'] != false
          ? map['projectnation'].toString() as String?
          : "",
      province:
          map['province'] != false ? map['province'].toString() as String? : "",
      projectnature: map['projectnature'] != false
          ? map['projectnature'].toString() as String?
          : "",
      customername: map['customername'] != false
          ? map['customername'].toString() as String?
          : "",
      bidcategory: map['bidcategory'] != false
          ? map['bidcategory'].toString() as String?
          : "",
      bidagency: map['bidagency'] != false
          ? map['bidagency'].toString() as String?
          : "",
      productname: map['productname'] != false
          ? map['productname'].toString() as String?
          : "",
      projectattribute: map['projectattribute'] != false
          ? map['projectattribute'].toString() as String?
          : "",
      projectsize:
          map['projectsize'] != false ? map['projectsize'].toString() : null,
      projectbudget:
          map['projectbudget'] != false ? map['projectbudget'] : null,
      buydeadline: map['buydeadline'] != false
          ? map['buydeadline'].toString().substring(0, 10) as String?
          : "",
      clarifydeadline: map['clarifydeadline'] != false
          ? map['clarifydeadline'].toString().substring(0, 10) as String?
          : "",
      biddeadline: map['biddeadline'] != false
          ? map['biddeadline'].toString().substring(0, 10) as String?
          : "",
      openingdate: map['openingdate'] != false
          ? map['openingdate'].toString().substring(0, 10) as String?
          : "",
      publicitydate: map['publicitydate'] != false
          ? map['publicitydate'].toString().substring(0, 10) as String?
          : "",
      deliverydate: map['deliverydate'] != false
          ? map['deliverydate'].toString().substring(0, 10) as String?
          : "",
      tenderfee: map['tenderfee'] != false ? map['tenderfee'] : null,
      bidfree: map['bidfree'] != false ? map['bidfree'] : null,
      checkfee: map['checkfee'] != false ? map['checkfee'] : null,
      agencyservicefee: map['agencyservicefee'] != false
          ? map['agencyservicefee'].toString() as String?
          : "",
      performancebond: map['performancebond'] != false
          ? map['performancebond'].toString() as String?
          : "",
      bidmethod: map['bidmethod'] != false
          ? map['bidmethod'].toString() as String?
          : "",
      priceevaluation: map['priceevaluation'] != false
          ? map['priceevaluation'].toString() as String?
          : "",
      businesscontacts: map['businesscontacts'] != false
          ? map['businesscontacts'].toString() as String?
          : "",
      businesscontactsnumber: map['businesscontactsnumber'] != false
          ? map['businesscontactsnumber'].toString() as String?
          : "",
      technologycontacts: map['technologycontacts'] != false
          ? map['technologycontacts'].toString() as String?
          : "",
      technologycontactsnumber: map['technologycontactsnumber'] != false
          ? map['technologycontactsnumber'].toString() as String?
          : "",
      issecondbargaining: map['issecondbargaining'] != false
          ? map['issecondbargaining'].toString() as String?
          : "",
      projectintroduction: map['projectintroduction'] != false
          ? map['projectintroduction'].toString() as String?
          : "",
      qualificationdocuments: map['qualificationdocuments'] != false
          ? map['qualificationdocuments'].toString() as String?
          : "",
      samplerequirements: map['samplerequirements'] != false
          ? map['samplerequirements'].toString() as String?
          : "",
      brandpatentrequirements: map['brandpatentrequirements'] != false
          ? map['brandpatentrequirements'].toString() as String?
          : "",
      environmentalrequirements: map['environmentalrequirements'] != false
          ? map['environmentalrequirements'].toString() as String?
          : "",
      packagingrequirements: map['packagingrequirements'] != false
          ? map['packagingrequirements'].toString() as String?
          : "",
      bidmaker:
          map['bidmaker'] != false ? map['bidmaker'].toString() as String? : "",
      bidresults: map['bidresults'] != false
          ? map['bidresults'].toString() as String?
          : "",
      pricedetermination: map['pricedetermination'] != false
          ? map['pricedetermination'].toString() as String?
          : "",
      quotationaccuracy: map['quotationaccuracy'] != false
          ? int.parse(map['quotationaccuracy'])
          : null,
      // quotationaccuracy: map['quotationaccuracy'] != false
      //     ? map['quotationaccuracy'].toString() as String?
      //     : "",
      profitmargin:
          map['profitmargin'] != false ? int.parse(map['profitmargin']) : null,

      // profitmargin: map['profitmargin'] != false
      //     ? map['profitmargin'].toString() as String?
      //     : "",
      profit: map['profit'] != false ? map['profit'].toString() as String? : "",
      formId: map['form_id'] != false
          ? map['form_id'][0].toString() as String?
          : null,
      createUid: map['create_uid'] != false
          ? map['create_uid'].toString() as String?
          : "",
      createDate: map['create_date'] != false
          ? map['create_date'].toString() as String?
          : "",
      writeUid: map['write_uid'] != false
          ? map['write_uid'].toString() as String?
          : "",
      writeDate: map['write_date'] != false
          ? map['write_date'].toString() as String?
          : "",
    );
  }

  Map<String, dynamic> toMap() {
    // ignore: unnecessary_cast
    return {
      'id': this.id,
      'projectcategory': this.projectcategory,
      'projectcode': this.projectcode,
      'projectname': this.projectname,
      'projectnation': this.projectnation,
      'province': this.province,
      'projectnature': this.projectnature,
      'customername': this.customername,
      'bidcategory': this.bidcategory,
      'bidagency': this.bidagency,
      'productname': this.productname,
      'projectattribute': this.projectattribute,
      'projectsize': this.projectsize,
      'projectbudget': this.projectbudget,
      'buydeadline': this.buydeadline,
      'clarifydeadline': this.clarifydeadline,
      'biddeadline': this.biddeadline,
      'openingdate': this.openingdate,
      'publicitydate': this.publicitydate,
      'deliverydate': this.deliverydate,
      'tenderfee': this.tenderfee,
      'bidfree': this.bidfree,
      'checkfee': this.checkfee,
      'agencyservicefee': this.agencyservicefee,
      'performancebond': this.performancebond,
      'bidmethod': this.bidmethod,
      'priceevaluation': this.priceevaluation,
      'businesscontacts': this.businesscontacts,
      'businesscontactsnumber': this.businesscontactsnumber,
      'technologycontacts': this.technologycontacts,
      'technologycontactsnumber': this.technologycontactsnumber,
      'issecondbargaining': this.issecondbargaining,
      'projectintroduction': this.projectintroduction,
      'qualificationdocuments': this.qualificationdocuments,
      'samplerequirements': this.samplerequirements,
      'brandpatentrequirements': this.brandpatentrequirements,
      'environmentalrequirements': this.environmentalrequirements,
      'packagingrequirements': this.packagingrequirements,
      'bidmaker': this.bidmaker,
      'bidresults': this.bidresults,
      'pricedetermination': this.pricedetermination,
      'quotationaccuracy': this.quotationaccuracy,
      'profitmargin': this.profitmargin,
      'profit': this.profit,
      'formId': this.formId,
      'createUid': this.createUid,
      'createDate': this.createDate,
      'writeUid': this.writeUid,
      'writeDate': this.writeDate,
    } as Map<String, dynamic>;
  }

  List toDomainList() {
    List list = [
      if (this.projectcategory != null && this.projectcategory != '')
        ['projectcategory', '=', this.projectcategory],
      if (this.projectcode != null && this.projectcode != '')
        ['projectcode', '=', this.projectcode],
      if (this.projectname != null && this.projectname != '')
        ['projectname', 'like', '%${this.projectname}%'],
      // 开标日期
      if (this.createDateStart != null && this.createDateStart != '')
        ['openingdate', '>=', this.createDateStart],
      if (this.createDateEnd != null && this.createDateEnd != '')
        ['openingdate', '<=', this.createDateEnd],
    ] as List;
    //if(list.length==0){
    //  list.add(['id','!=',null]);
    //}
    // ignore: unnecessary_cast
    return list;
  }

  Map<String, dynamic> toOdooMap() {
    // ignore: unnecessary_cast
    return {
      'id': this.id,
      'projectcategory': this.projectcategory,
      'projectcode': this.projectcode,
      'projectname': this.projectname,
      'projectnation': this.projectnation,
      'province': this.province,
      'projectnature': this.projectnature,
      'customername': this.customername,
      'bidcategory': this.bidcategory,
      'bidagency': this.bidagency,
      'productname': this.productname,
      'projectattribute': this.projectattribute,
      'projectsize': this.projectsize,
      'projectbudget': this.projectbudget,
      'buydeadline': this.buydeadline == "" ? null : this.buydeadline,
      'clarifydeadline':
          this.clarifydeadline == "" ? null : this.clarifydeadline,
      'biddeadline': this.biddeadline == "" ? null : this.biddeadline,
      'openingdate': this.openingdate == "" ? null : this.openingdate,
      'publicitydate': this.publicitydate == "" ? null : this.publicitydate,
      'deliverydate': this.deliverydate == "" ? null : this.deliverydate,
      'tenderfee': this.tenderfee,
      'bidfree': this.bidfree,
      'checkfee': this.checkfee,
      'agencyservicefee': this.agencyservicefee,
      'performancebond': this.performancebond,
      'bidmethod': this.bidmethod,
      'priceevaluation': this.priceevaluation,
      'businesscontacts': this.businesscontacts,
      'businesscontactsnumber': this.businesscontactsnumber,
      'technologycontacts': this.technologycontacts,
      'technologycontactsnumber': this.technologycontactsnumber,
      'issecondbargaining': this.issecondbargaining,
      'projectintroduction': this.projectintroduction,
      'qualificationdocuments': this.qualificationdocuments,
      'samplerequirements': this.samplerequirements,
      'brandpatentrequirements': this.brandpatentrequirements,
      'environmentalrequirements': this.environmentalrequirements,
      'packagingrequirements': this.packagingrequirements,
      'bidmaker': this.bidmaker,
      'bidresults': this.bidresults,
      'pricedetermination': this.pricedetermination,
      'quotationaccuracy': this.quotationaccuracy,
      'profitmargin': this.profitmargin,
      'profit': this.profit,
      'form_id': this.formId,
      'create_uid': this.createUid,
      'create_date': this.createDate,
      'write_uid': this.writeUid,
      'write_date': this.writeDate,
    } as Map<String, dynamic>;
  }

//</editor-fold>

}
